feat(plugin-coverage): add setup wizard binding#1273
feat(plugin-coverage): add setup wizard binding#1273hanna-skryl wants to merge 1 commit intomainfrom
Conversation
|
View your CI Pipeline Execution ↗ for commit 6876789
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit dd537d9 with previous commit 28ccfcb. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 2 groups improved, 👎 2 groups regressed, 👍 5 audits improved, 👎 6 audits regressed, 15 audits changed without impacting score🗃️ Groups
30 other groups are unchanged. 🛡️ Audits
652 other audits are unchanged. |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit dd537d9 with previous commit 28ccfcb. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🟡 69 | 🟡 68 | |
| Code coverage | 🟢 92 | 🟢 92 |
4 other categories are unchanged.
👍 1 group improved, 👎 1 group regressed, 👍 3 audits improved, 👎 1 audit regressed, 2 audits changed without impacting score
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🟡 69 | 🟡 68 | |
| Code coverage | Code coverage metrics | 🟢 92 | 🟢 92 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| JSDocs coverage | Functions coverage | 🟥 22 undocumented functions | 🟥 32 undocumented functions | |
| Code coverage | Line coverage | 🟨 89.1 % | 🟩 90.7 % | |
| Code coverage | Branch coverage | 🟨 89.6 % | 🟨 89.7 % | |
| Code coverage | Function coverage | 🟩 93.5 % | 🟩 93.6 % | |
| JSDocs coverage | Variables coverage | 🟥 13 undocumented variables | 🟥 23 undocumented variables | |
| JSDocs coverage | Types coverage | 🟥 8 undocumented types | 🟥 11 undocumented types |
438 other audits are unchanged.
💼 Project create-cli
🤨 Code PushUp report has both improvements and regressions.
🕵️ See full comparison in Code PushUp portal 🔍
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Code coverage | 🟢 90 | 🟢 90 | |
| Documentation | 🔴 24 | 🔴 24 |
4 other categories are unchanged.
👍 1 group improved, 👎 1 group regressed, 👍 2 audits improved, 👎 2 audits regressed
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| Code coverage | Code coverage metrics | 🟢 90 | 🟢 90 | |
| JSDocs coverage | Documentation coverage | 🔴 24 | 🔴 24 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Line coverage | 🟩 91.2 % | 🟩 90.9 % | |
| JSDocs coverage | Functions coverage | 🟥 51 undocumented functions | 🟥 52 undocumented functions | |
| Code coverage | Function coverage | 🟨 89.9 % | 🟩 90 % | |
| Code coverage | Branch coverage | 🟩 90.8 % | 🟩 90.9 % |
439 other audits are unchanged.
💼 Project models
😟 Code PushUp report has regressed.
🕵️ See full comparison in Code PushUp portal 🔍
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Code coverage | 🟢 94 | 🟢 94 |
3 other categories are unchanged.
👎 1 group regressed, 👎 1 audit regressed
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| Code coverage | Code coverage metrics | 🟢 94 | 🟢 94 |
11 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Line coverage | 🟩 95 % | 🟩 94.8 % |
436 other audits are unchanged.
11 other projects are unchanged.
matejchalk
left a comment
There was a problem hiding this comment.
The new adjustments mechanism is very elegant. 👍
| it('should add coverage block to vitest config when missing', () => { | ||
| const input = `import { defineConfig } from 'vitest/config'; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| globals: true, | ||
| }, | ||
| }); | ||
| `; | ||
| expect(addLcovReporter(input, 'vitest')).toMatchInlineSnapshot(` | ||
| "import { defineConfig } from 'vitest/config'; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| globals: true, | ||
|
|
||
| coverage: { | ||
| reporter: ['lcov'], | ||
| }, | ||
| }, | ||
| });" | ||
| `); | ||
| }); |
There was a problem hiding this comment.
We could be overwriting default coverage.reporter values with this change. Perhaps we should also include the default ['text', 'html', 'clover', 'json']. 🤔 A missing coverage configuration doesn't mean coverage isn't already being collected just by including --coverage.enabled in the vitest command.
| it('should add coverageReporters to jest config when missing', () => { | ||
| const input = `export default { | ||
| testEnvironment: 'node', | ||
| }; | ||
| `; | ||
| expect(addLcovReporter(input, 'jest')).toMatchInlineSnapshot(` | ||
| "export default { | ||
| testEnvironment: 'node', | ||
| coverageReporters: ['lcov'], | ||
| };" | ||
| `); | ||
| }); |
There was a problem hiding this comment.
Jest actually includes lcov in its default coverageReporters - ["clover", "json", "lcov", "text"]. So I don't think we need to add anything if coverageReporters are missing entirely. 🤔
| it('should return CJS config unchanged', () => { | ||
| const input = `module.exports = { coverageReporters: ['text'] };`; | ||
| expect(addLcovReporter(input, 'jest')).toBe(input); | ||
| }); |
There was a problem hiding this comment.
Aren't we able to add LCOV to CommonJS configs as well? I'm guessing that CommonJS configs are still very common for Jest.
matejchalk
left a comment
There was a problem hiding this comment.
(I clicked Approve automatically without thinking. 🤦)
Closes #1254
Coverage plugin binding for the setup wizard. Auto-detects Jest/Vitest, prompts for coverage options with smart defaults, and generates plugin initialization code.
For Jest/Vitest, it produces
adjustments(a new field onPluginCodegenResult) that adds an LCOV reporter to the test config usingmagicast(0.3.x, as the latest 0.5.x is incompatible with ourmoduleResolution: "node").